'use strict';
Object.defineProperties(exports, {
  __esModule: { value: !0 },
  [Symbol.toStringTag]: { value: 'Module' },
});
function A(e, c, f, l) {
  switch (e) {
    case 0:
      return (c & f) ^ (~c & l);
    case 1:
      return c ^ f ^ l;
    case 2:
      return (c & f) ^ (c & l) ^ (f & l);
    case 3:
      return c ^ f ^ l;
  }
}
function h(e, c) {
  return (e << c) | (e >>> (32 - c));
}
function M(e) {
  const c = [1518500249, 1859775393, 2400959708, 3395469782],
    f = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
  if (typeof e == 'string') {
    const r = decodeURIComponent(encodeURIComponent(e));
    e = [];
    for (let o = 0; o < r.length; ++o) e.push(r.charCodeAt(o));
  } else Array.isArray(e) || (e = Array.prototype.slice.call(e));
  e.push(128);
  const l = e.length / 4 + 2,
    a = Math.ceil(l / 16),
    x = new Array(a);
  for (let r = 0; r < a; ++r) {
    const o = new Uint32Array(16);
    for (let n = 0; n < 16; ++n)
      o[n] =
        (e[r * 64 + n * 4] << 24) |
        (e[r * 64 + n * 4 + 1] << 16) |
        (e[r * 64 + n * 4 + 2] << 8) |
        e[r * 64 + n * 4 + 3];
    x[r] = o;
  }
  (x[a - 1][14] = ((e.length - 1) * 8) / Math.pow(2, 32)),
    (x[a - 1][14] = Math.floor(x[a - 1][14])),
    (x[a - 1][15] = ((e.length - 1) * 8) & 4294967295);
  for (let r = 0; r < a; ++r) {
    const o = new Uint32Array(80);
    for (let t = 0; t < 16; ++t) o[t] = x[r][t];
    for (let t = 16; t < 80; ++t)
      o[t] = h(o[t - 3] ^ o[t - 8] ^ o[t - 14] ^ o[t - 16], 1);
    let n = f[0],
      i = f[1],
      u = f[2],
      d = f[3],
      s = f[4];
    for (let t = 0; t < 80; ++t) {
      const p = Math.floor(t / 20),
        g = (h(n, 5) + A(p, i, u, d) + s + c[p] + o[t]) >>> 0;
      (s = d), (d = u), (u = h(i, 30) >>> 0), (i = n), (n = g);
    }
    (f[0] = (f[0] + n) >>> 0),
      (f[1] = (f[1] + i) >>> 0),
      (f[2] = (f[2] + u) >>> 0),
      (f[3] = (f[3] + d) >>> 0),
      (f[4] = (f[4] + s) >>> 0);
  }
  return [
    (f[0] >> 24) & 255,
    (f[0] >> 16) & 255,
    (f[0] >> 8) & 255,
    f[0] & 255,
    (f[1] >> 24) & 255,
    (f[1] >> 16) & 255,
    (f[1] >> 8) & 255,
    f[1] & 255,
    (f[2] >> 24) & 255,
    (f[2] >> 16) & 255,
    (f[2] >> 8) & 255,
    f[2] & 255,
    (f[3] >> 24) & 255,
    (f[3] >> 16) & 255,
    (f[3] >> 8) & 255,
    f[3] & 255,
    (f[4] >> 24) & 255,
    (f[4] >> 16) & 255,
    (f[4] >> 8) & 255,
    f[4] & 255,
  ];
}
exports.default = M;
